package com.wjd.wshow.util;

import org.apache.commons.io.FileUtils;

import java.io.File;
import java.util.Collection;

public class FileUtil {

    private static String[] videoExt = {"mp4", "avi", "rmvb", "mpg", "mpeg", "rm", "wmv", "mov", "mkv"};

    private FileUtil() {
    }

    /**
     * 递归获取所有文件
     * @param path 目录
     * @return 文件列表
     */
    public static Collection<File> findVideos(String path) {
        File dir = new File(path);
        Collection<File> files = FileUtils.listFiles(dir, videoExt, true);
        return files;
    }
}
